Don't interpolate between keywords
authorMatthias Clasen <mclasen@redhat.com>
Thu, 7 Jan 2016 21:10:10 +0000 (16:10 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 7 Jan 2016 21:13:26 +0000 (16:13 -0500)
Transitioning between linear gradients like
linear-gradient(to top, yellow, green) and
linear-gradient(to left, yellow, green) was yielding
nonsensical results, with the gradient line jumping around
wildly. Fix this by falling back to stupid image interpolation
for these cases.

gtk/gtkcssimagelinear.c

index 093a3084484e86bff0ad408886f27a5ec33d7ef0..492d04a69dc2887a3b2c0f4bf73aeabe9e011220 100644 (file)
@@ -492,6 +492,10 @@ gtk_css_image_linear_transition (GtkCssImage *start_image,
   result = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
   result->repeating = start->repeating;
 
+  if (_gtk_css_number_value_get_unit (start->angle) == GTK_CSS_NUMBER ||
+      _gtk_css_number_value_get_unit (end->angle) == GTK_CSS_NUMBER)
+    goto fail;
+
   result->angle = _gtk_css_value_transition (start->angle, end->angle, property_id, progress);
   if (result->angle == NULL)
     goto fail;